package com.eastfair.venueservice.controller;

import com.eastfair.core.base.R;
import com.eastfair.core.exception.BizException;
import com.eastfair.home.dto.ReportSpaceAuditDTO;
import com.eastfair.venueservice.service.ReportSpaceMustPayOrderService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 报馆必缴订单 REST API
 *
 * @author dqq
 * @date 2023 /6/9
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/reportSpaceMustOrder")
public class ReportSpaceMustPayOrderController {

    @Resource
    private ReportSpaceMustPayOrderService reportSpaceMustPayOrderService;

    /**
     * 搭建商报馆审核通过生成必缴订单.
     *
     * @param reportSpaceAuditDTO reportSpaceAudit.
     * @return the r
     */
    @ApiOperation("搭建商报馆审核通过生成必缴订单")
    @PostMapping("/save")
    public R<Boolean> saveMustPayOrder(@RequestBody ReportSpaceAuditDTO reportSpaceAuditDTO) {
        log.info("saveMustPayOrder - 搭建商报馆审核通过生成必缴订单, serviceOrderDTO={}", reportSpaceAuditDTO);
        try {
            return R.successDef(reportSpaceMustPayOrderService.saveMustPayOrder(reportSpaceAuditDTO));
        } catch (BizException e) {
            return R.fail(e);
        }
    }
}